home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Mac OS / AIAT / Headers / Corpus / StringCorpus.h < prev   
Encoding:
Text File  |  1998-04-16  |  1.4 KB  |  65 lines  |  [TEXT/CWIE]

  1. // StringCorpus.h
  2. //    Copyright:    © 1994 - 1998 by Apple Computer, Inc., all rights reserved.
  3.  
  4.  
  5. // a corpus that is a set of memory-resident strings
  6. // this is useful for test programs
  7.  
  8. #pragma once
  9. #ifndef StringCorpus_h
  10. #define StringCorpus_h
  11.  
  12. #pragma import on
  13. #if PRAGMA_STRUCT_ALIGN
  14.     #pragma options align=power
  15. #endif
  16.  
  17. #include "IACorpus.h"
  18.  
  19. #pragma IA_BEGIN_EXPORTS
  20.  
  21. const uint32    StringCorpusType = 'Str0';
  22.  
  23. class StringDoc : public IADoc {
  24. public:
  25.                 StringDoc() : text(NULL), textLen(0) {}
  26.                 StringDoc(const char* text);
  27.                 StringDoc(char* text, uint32 textLen, bool makeCopy = true);
  28. //                StringDoc(StringDoc& fd) : IADoc(fd) {}
  29.     virtual        ~StringDoc();
  30.  
  31.     IAStorable*    DeepCopy() const;
  32.     uint32        StoreSize() const;
  33.     void        Store(IAOutputBlock* output) const;
  34.     IAStorable*    Restore(IAInputBlock* input) const;
  35.  
  36.     bool        LessThan(const IAOrderedStorable* neighbor) const;
  37.     bool        Equal(const IAOrderedStorable* neighbor) const;
  38.  
  39.     char*        GetText() const {return text;}
  40.     uint32        GetLength() const {return textLen;}
  41.     
  42. private:
  43.  
  44.     char*        text;
  45.     uint32        textLen;
  46. };
  47.  
  48. class StringCorpus : public IACorpus {
  49. public:    
  50.                 StringCorpus() : IACorpus(StringCorpusType) {}
  51. //                StringCorpus(StringCorpus& fc) : IACorpus(fc) {}
  52.     virtual        ~StringCorpus() {}
  53.     IADoc*        GetProtoDoc();
  54.     IADocText*    GetDocText(const IADoc* doc);
  55. };
  56.  
  57. #pragma IA_END_EXPORTS
  58.  
  59. #if PRAGMA_STRUCT_ALIGN
  60.     #pragma options align=reset
  61. #endif
  62.  
  63. #pragma import reset
  64. #endif
  65.